package emulator.hardware.nmos6502.commands;

import emulator.EmulatorException;
import emulator.hardware.nmos6502.Command;
import emulator.hardware.nmos6502.CommandSet;
import emulator.hardware.nmos6502.Cpu6502;
import emulator.hardware.nmos6502.Flags6502;
import emulator.hardware.nmos6502.Operand;
import emulator.hardware.nmos6502.operands.Displacement;

public class BVC implements Command {

	@Override
	public void execute(Cpu6502 cpu, Operand operand) throws EmulatorException {
		if (!cpu.getFlags().getOverflow())
			cpu.branch(operand.getByte());
	}

	@Override
	public String getName() {
		return "BVC";
	}

	@Override
	public void register(CommandSet cset) {
		cset.defineCommand(0x50, this, new Displacement(Flags6502.BIT_OVERFLOW, false));
	}

}
